﻿using System;
using System.Web.Configuration;
using SAS.WebSite.BaseClasses;

namespace SAS.WebSite.VisualControls.Nav
{
    public partial class Header : BaseUserControl
    {
        //private Navigation HeaderNav;
        
        protected void Page_Load(object sender, EventArgs e)
        {
            debug.Text = " (from IP-" + ((BasePage)Page).Ip + ") ::  " + WebConfigurationManager.AppSettings["Version"];
            BuildNavigation();
            litUser.Text = "<span id=\"spanUser\">" + (((BasePage)Page).User).Email + "</span>";
        }
        protected void BuildNavigation()
        {

            //Navigation FullNav = ((BasePage)Page).SiteNavigation;
            //NavigationItem CurrentNav = ((BasePage)Page).CurrentNavItem;
            //HeaderNav = new Navigation();
            //HeaderNav.Items = FullNav.Items.Where(x => x.Type == (int)NavType.header && x.Name != "Help" && x.Name != "Alerts").ToList();
            //if (HeaderNav != null)
            //{
            //    int itemrow = 0;
            //    StringBuilder sb = new StringBuilder();
            //    foreach (NavigationItem item in HeaderNav.Items)
            //    {
            //        sb.Append("<td class=\"tdnav\"><a href=\"");
            //        if (item.Name.ToLower().Contains("logout"))
            //        {
            //            sb.Append("../default.aspx?status=logout");
            //        }
            //        else
            //        {
            //            sb.Append(item.Url);
            //        }
            //        sb.Append("\"><span class=\"navlinkWrapper\">");
            //        sb.Append(item.Name);
            //        sb.Append("</span></a></td>");
            //        itemrow++;
            //    }
            //    litNav.Text = sb.ToString();
            //}
        }

    }
}